'use strict';
angular.module('app')
  .config(['$provide', function($provide) {
    $provide.decorator('$http', ['$delegate', '$q', function($delegate, $q) {
      var get = $delegate.get;
      $delegate.post = function(url, data, config) {
        var defer = $q.defer(); //声明延后执行
        get(url).then(function(success) {
          defer.resolve(success.data); //执行成功
        }, function(error) {
          defer.reject(error); //执行失败
        });
        return defer.promise; //返回获取的数据
      }
      return $delegate;
    }])
  }])
